<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <link href="css/login.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
</head>
<body>
	<form class="mui-input-group adming_login_border admin_login_wrap">
		
		<div class="mui-input-row admin_items admin_input">
			<label>用 户 名</label>
			<input id="username" type="text" class="admin_input_style mui-input-clear" placeholder="请输入您的用户名"/>
		</div>
		
		<div class="mui-input-row admin_input">
			<label>密 码</label>
			<input id="password" type="password" class="mui-input-password admin_input_style" placeholder="请输入您的密码"/>
		</div>
		
		</form>
		
		<div class="mui-button-row">
			<br/><br/>
			<button id="registe" class="mui-btn mui-btn-primary">注 册</button>
			<button id="login" class="mui-btn mui-btn-primary">登 陆</button>
			<button id="cancel" class="mui-btn mui-btn-danger">取 消</button>
		</div>
	
	<script>
		
		var btn=document.getElementById("registe");
		btn.addEventListener("tap", function() {
			mui.openWindow("registe.html")
		})
		
		var btn=document.getElementById("login");
		btn.addEventListener("tap", function() {
			var username=document.getElementById("username").value
			var passwd=document.getElementById("password").value
			//mui.alert(username+passwd)
			mui.ajax("http://www.liwbiy.com:8080/Leisurelife/dealcmd", {
				type:"post",
				data:{
					cmd:0,
					name:username,
					password:passwd,
				},
				timeout:5000,
				success:function(data){
					//mui.alert("成功")
					
					//str.parseJSON(data);
					var json = eval('('+data+')')
					if(json.code === '0') {
						//mui.alert("Success")
						mui.openWindow("main.html")
					}else {
						mui.alert("用户名或密码错误")
					}
					
				},
				error:function(data){
					mui.alert("失败")
				}
			})
		})
	</script>
	
</body>
</html>